From 8913382f9959ece80b625ff86e86cafb63053b22 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 7 Feb 2017 00:13:37 -0500 Subject: [PATCH] Update the 'run_with_library_paths' test to reflect the new filtering. For the library paths to be passed through, they must reside within the build output directory. --- tests/run.rs | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/run.rs b/tests/run.rs index bca7680cf..8caa3c7e7 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -597,30 +597,37 @@ hello #[test] fn run_with_library_paths() { - let p = project("foo") - .file("Cargo.toml", r#" + let mut p = project("foo"); + + // Only link search directories within the target output directory are + // propagated through to dylib_path_envvar() (see #3366). + let mut dir1 = p.target_debug_dir(); + dir1.push("foo"); + + let mut dir2 = p.target_debug_dir(); + dir2.push("dir=containing=equal=signs"); + + p = p.file("Cargo.toml", r#" [project] name = "foo" version = "0.0.1" authors = [] build = "build.rs" "#) - .file("build.rs", r#" - fn main() { - println!("cargo:rustc-link-search=native=foo"); - println!("cargo:rustc-link-search=bar"); - println!("cargo:rustc-link-search=/path=containing=equal=signs"); - } - "#) + .file("build.rs", &format!(r#" + fn main() {{ + println!("cargo:rustc-link-search=native={}"); + println!("cargo:rustc-link-search={}"); + }} + "#, dir1.display(), dir2.display())) .file("src/main.rs", &format!(r#" fn main() {{ let search_path = std::env::var_os("{}").unwrap(); let paths = std::env::split_paths(&search_path).collect::>(); - assert!(paths.contains(&"foo".into())); - assert!(paths.contains(&"bar".into())); - assert!(paths.contains(&"/path=containing=equal=signs".into())); + assert!(paths.contains(&"{}".into())); + assert!(paths.contains(&"{}".into())); }} - "#, dylib_path_envvar())); + "#, dylib_path_envvar(), dir1.display(), dir2.display())); assert_that(p.cargo_process("run"), execs().with_status(0)); } -- 2.30.2